package com.xiaoyang.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author lichenyang
 * @create 2021-07-11 10:19
 *
 * @RestController: 包含 @Controller 和 @ResponseBody 如果程序想返回内容, 而不是跳转页面, 就使用@ResponseBody
 */
@Slf4j
@RestController
public class HelloController {

    @RequestMapping("/helloWorld")
    public String helloWorld(){
//        System.out.println(10/0);

        return "hello world";
    }


    /**
     * 演示, 如果路径名和图片名称相同, springMVC 会跳转字符串还是跳转图片
     *
     * @return
     */
    @RequestMapping("/1.jpg")
    public String testTrans(){
        return "跳转字符串? 还是跳转图片";
    }

}
